package com.training.interceptor;

import com.jfinal.aop.Interceptor;
import com.jfinal.aop.Invocation;
import com.training.common.model.User;

public class LoginInterceptor implements Interceptor {

    public void intercept(Invocation inv) {
        User user = inv.getController().getSessionAttr("trainingsession");
        if(user == null){
            inv.getController().render("/login.html");
        }else{
            inv.invoke();
        }
    }
}
